<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="/css/firstFillInfor.css" />
	<title>选择设备</title>
	<style type="text/css">
	</style>
</head>
<body>
	<section class="firstFillInfor pages">
		<p>绑定水机前准确填写个人信息</p>
		<section class="fillBoxList">
			<section>
				<p>
					<img src="/img/userNameLg.png" />
					<span>用户姓名：</span>
				</p>
				<input class="nameBox" placeholder="用户姓名" value="{{ $user_info['name'] or ''}}" />
				<img src="/img/errorLg.png" />
			</section>
			<section>
				<p>
					<img src="/img/IDLg.png" />
					<span>身份证号：</span>
				</p>
				<input class="IDBox" placeholder="身份证号" value="{{ $user_info['id_number'] or ''}}" />
				<img src="/img/errorLg.png" />
			</section>
			<section>
				<p>
					<img src="/img/phoneLg.png" />
					<span>手机号码：</span>
				</p>
				<input class="phoneBox" placeholder="手机号码" value="{{ $user_info['phone'] or ''}}" />
				<img src="/img/errorLg.png" />
			</section>
			<section>
				<p>
					<img src="/img/addressLg.png" />
					<span>安装地址：</span>
				</p>
				<input class="adressBox" placeholder="安装地址" value="{{ $user_info['installation_address'] or ''}}" />
				<img src="/img/errorLg.png" />
			</section>
		</section>
		<a class="okBtn">确定</a>
		<p class="footerHint">温馨提示：为了及时有效为您提供售后服务，请准确填写用户资料</p>
	</section>
	<!-- 提交信息服务器反馈提示信息-->
	<section class="hint_bg" style="display: none;">
		<section class="hint_box" style="height: 10rem;">
			<p class="hint_text" style="margin-top: 2.5rem;"></p>
			<section class="hint_btn" style="margin: 2rem auto;">确定</section>
		</section>
	</section>
	<script src="/js/jquery.min.js"></script>
	<script src="/js/public.js"></script>
	<script src="/js/firstFillInfor.js"></script>
	<script type="text/javascript">
	$(".okBtn").click(function(){
		var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
  		if($(".nameBox").val()==""){
  			$(".nameBox").siblings("img").show();
  		}else if(reg.test($(".IDBox").val()) === false){
  			$(".IDBox").siblings("img").show();
		}else if(!(/^1[34578]\d{9}$/.test($(".phoneBox").val()))){
			$(".phoneBox").siblings("img").show();
		}else if($(".adressBox").val()==""){
			$(".adressBox").siblings("img").show();
		}else{
			$(".nameBox").siblings("img").hide();
			$(".IDBox").siblings("img").hide();
			$(".phoneBox").siblings("img").hide();
			$(".adressBox").siblings(".img").hide();
			$.ajax({
				url:"/api/user/info",
				type:"post",
				dataType:"json",
				data:{
					name:$(".nameBox").val(),
					id_number:$(".IDBox").val(),
					phone:$(".phoneBox").val(),
					installation_address:$(".adressBox").val()
				},
				success:function(data){
					if(data.status.errCode==0){
						window.location.href="/device/{{ $type }}/bind";
					}else{
						hint(data.status.message);
					}
				}
			});
		}
	});

	</script>
</body>
</html>